home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / pdselect / awnp / awnp-docs / sexample.doc < prev    next >
Text File  |  2000-02-16  |  3KB  |  73 lines

  1. The simplest use of awnpipe is as an ordinary pipe. That means put data into one end of a pipe and read it out the other.
  2.  
  3. In a shell type 'echo >awnpipe:mypipe hello'
  4. Now type 'type awnpipe:mypipe'
  5.  
  6. The word hello went into the pipe from the echo command, and came out with the type command. 
  7.  
  8. HINT: Drag select the text then use right Amiga C to copy the examples out of these docs. This helps avoid typos.
  9. ---
  10.  
  11. 'mypipe' was the name of the pipe. More than one pipe can exist at the same time.
  12.  
  13. In a shell type 'echo >awnpipe:mypipe1 hello'
  14. In a shell type 'echo >awnpipe:mypipe2 goodbye'
  15. In a shell type 'type awnpipe:mypipe1'
  16. In a shell type 'type awnpipe:mypipe2'
  17.  
  18. Two pipes each with a different name.
  19.  
  20. ---
  21.  
  22. Make sure you have two different shells available.
  23.  
  24. In the first shell type 'type awnpipe:mypipe'
  25. In the second shell type 'echo >awnpipe:mypipe hello'
  26.  
  27. You opened the read end of the pipe first. The type command waited until data was available from the pipe THEN returned.
  28.  
  29. A word of caution. NEVER try to read from both ends of the pipe at the same time. If you 'type awnpipe:mypipe1' in two separate shells both will hang waiting for data to come from the pipe.
  30.  
  31. If this happens to you during testing open the pipe a third time adding '/a' to the pipename 'type awnpipe:mypipe/a'. This causes the pending reads to abort and the deadlock ends.
  32.  
  33. ---
  34.  
  35. To use AWNPipe for other functions you add '/' followed by some parameters to the pipe name.'/h' will cause the pipe to translate a few special characters to there HTML equivalents. Note that the '/h' is only used when writing to the pipe.
  36.  
  37. In a shell type 'echo >awnpipe:mypipe/h "& > <"'
  38. In a shell type 'type awnpipe:mypipe'
  39.  
  40. See the advanced examples for more types of data conversion.
  41.  
  42. ---
  43.  
  44. It is possible to have a pipe automatically connect it self to a file.
  45. '/wFILENAME' writes the output of the pipe to FILENAME.
  46.  
  47. In a shell type 'echo >awnpipe:mypipe/h/wram:AWNPtest "& > <"'
  48.  
  49. YES there are two colons ':' in the redirection. Don't let it bug you.
  50.  
  51. Take a look at the file ram:AWNPtest (with your favorite text editor).
  52.  
  53. ---
  54.  
  55. '/u' reverses the translation done by '/h' and '/rFILENAME' reads data into a
  56. pipe.
  57.  
  58. In a shell type 'type awnpipe:mypipe/u/rram:AWNPtest'
  59.  
  60. The contents of the file are read and translated.
  61.  
  62. ---
  63.  
  64. It is possible to have a pipe automatically connect it self to the clipboard.
  65.  
  66. In a shell type 'echo >awnpipe:mypipe/c hello'
  67.  
  68. The word hello was placed into the clipboard. Use your text editor to check it out. Then put different text into the clipboard using your text editor.
  69.  
  70. In a shell type 'type awnpipe:mypipe/v'
  71.  
  72.  The contents of the clipboard are typed out.
  73.